<% deploying      = deployment && !%w(complete canceled).index(deployment.deploymentState)
   compiling      = environment.ciState == 'locked'
   has_transition = has_transition?(@assembly.ciId) %>
<div class="alert alert-block alert-info attention">
  <strong>Open Environment Release</strong> &raquo;
  <% if deploying %>
    Review open environment release.
  <% elsif compiling %>
    Review open environment release. <small>(You can not commit while deployment preparation is in progress.)</small>
  <% elsif has_transition %>
    Review, commit and deploy open environment release.
  <% else %>
    Review open environment release.
  <% end %>
  <div class="action">
    <%= link_to('Review',
                assembly_transition_environment_path(assembly, environment, :anchor => path_to_release(release).split('#').last),
                :class => 'btn btn-small btn-primary') %>
    <% if has_transition %>
      <% if compiling %>
        <%= button('Commit & Deploy', 'small', 'success disabled') %>
      <% else %>
        <%= render 'transition/commit_and_deploy_prompt', :button_label => deploying ? 'Commit' : 'Commit & Deploy', :button_size => 'small' %>
      <% end %>
    <% end %>
  </div>
</div>
